﻿$(function () {
    $("#FileUploadEmployeeImage").bind("change", function () {
        //开始提交
        $("#form1").ajaxSubmit({
            beforeSubmit: function (formData, jqForm, options) {
                //隐藏上传按钮
                $(".filesEmployeeImage").hide();
                //显示LOADING图片
                $(".uploadingEmployeeImage").show();
            },
            success: function (data, textStatus) {
                if (data.msg == 1) {
                    $("#txtEmployeeImage").val(data.msbox);
                } else {
                    alert(data.msbox);
                }
                $(".filesEmployeeImage").show();
                $(".uploadingEmployeeImage").hide();
                document.getElementById("imgEmployeeImage").innerHTML = "<img src=\"" + data.msbox + "\" />   ";
            },
            error: function (data, status, e) {
                alert("上传失败，错误信息：" + e);
                $(".filesEmployeeImage").show();
                $(".uploadingEmployeeImage").hide();
            },
            url: "../../Tools/EmployeeUpload/EmployeeImage.ashx",
            type: "post",
            dataType: "json",
            timeout: 600000
        });
    });
});